package com.gitee.huxing.course.config.mybatis;

import com.alibaba.druid.pool.DruidDataSource;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.sql.DataSource;

/**
 * @Description: 数据库配置
 * @ProjectName: JavaCourse
 * @Package: com.gitee.huxing.course.config.mybatis
 * @ClassName: MyBatiesPlusConfiguration
 * @Author: huxing
 * @DateTime: 2021-10-18 下午3:41
 */
@Configuration
@MapperScan(basePackages = "com.gitee.huxing.course.domain.mapper")
public class MyBatiesPlusConfiguration {

    /**
     * @Description: 配置主库数据源
     * @Author: huxing
     * @Date: 2021-05-22 18:51
     * @return: com.alibaba.druid.pool.DruidDataSource
     **/
    @Bean(name = "masterDataSource")
    @ConfigurationProperties(prefix = "spring.datasource.druid")
    public DataSource mastDataSource(){
        return new DruidDataSource();
    }
}
